package id.web.faisalabdillah.xtimesheet.domain;

import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;

import org.springframework.format.annotation.DateTimeFormat;

import com.google.appengine.api.datastore.Key;

@Entity
public class TimeSheet {
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private Key id;
	
	@Column
	@ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	private User user;
	
	@DateTimeFormat(pattern="MM-yyyy")
	@Column
	private Date month;
	
	@Column
	private String nama;
	
	@Column
	private String uid;
	
	@Column
	private String pemeriksa;
	
	@Column
	private String disetujui;
	
	@Column
	private String project_name;
	
	@Column
	private String location;

	@Column
	@OneToMany(mappedBy="timesheet",cascade=CascadeType.ALL,fetch=FetchType.EAGER)
	private List<TimeSheetDetail> detail;
	
	
	public List<TimeSheetDetail> getDetail() {
		return detail;
	}

	public void setDetail(List<TimeSheetDetail> detail) {
		this.detail = detail;
	}


	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}

	public Date getMonth() {
		return month;
	}

	public void setMonth(Date month) {
		this.month = month;
	}

	public String getNama() {
		return nama;
	}

	public void setNama(String nama) {
		this.nama = nama;
	}

	public String getUid() {
		return uid;
	}

	public void setUid(String uid) {
		this.uid = uid;
	}

	public String getPemeriksa() {
		return pemeriksa;
	}

	public void setPemeriksa(String pemeriksa) {
		this.pemeriksa = pemeriksa;
	}

	public String getDisetujui() {
		return disetujui;
	}

	public void setDisetujui(String disetujui) {
		this.disetujui = disetujui;
	}

	public String getProject_name() {
		return project_name;
	}

	public void setProject_name(String project_name) {
		this.project_name = project_name;
	}

	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public Key getId() {
		return id;
	}

	public void setId(Key id) {
		this.id = id;
	}
	
	
}
